package com.study.spring.proxy.api;

import com.study.spring.proxy.bo.Intention;
import com.study.spring.proxy.bo.Response;
import com.study.spring.proxy.bo.TicketBo;
import com.study.spring.proxy.client.OpportunityClient;
import com.study.spring.proxy.client.RemoteClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("saos-api")
public class SaosApi {


    @Autowired
    private RemoteClient saosHttpClient;

    @Autowired
    private OpportunityClient opportunityClient;

    @GetMapping("/get-intention-list")
    public Response getIntentionList(){
        Response<Intention> intentionLevelList = saosHttpClient.getIntentionLevelList();
        return intentionLevelList;
    }

    @GetMapping("/get-ticket")
    public Response getOpportunity(@RequestParam("cid") String cid){
        Response<TicketBo> customerTicket = opportunityClient.getCustomerTicket(cid);
        return customerTicket;
    }
}
